package com.gelsanalyzer.application;

import java.awt.*;
import java.beans.*;

import javax.swing.*;
import javax.swing.table.*;

import org.apache.log4j.*;

import com.gelsanalyzer.business.*;
import com.gelsanalyzer.mvc.controller.*;
import com.gelsanalyzer.mvc.view.*;

public class CourseEntryView extends AbstractViewPanel {
    private static final Logger log = Logger.getLogger(CourseEntryView.class);

    public CourseEntryView() {
        initComponents();
        doTheLayout();
    }

    // make all the objects
    public void initComponents() {
        courseTable = new JTable(new CourseEntryList());

        // put table in scrolling pane
        tablePane = new JScrollPane(courseTable);
        doTheLayout();
    }

    // Layout all the objects
    private void doTheLayout() {
        setLayout(new BorderLayout());
        add(tablePane);
    }

    public TableModel getTableModel() {
        return courseTable.getModel();
    }

    // Variables declaration
    private javax.swing.JScrollPane tablePane;
    private javax.swing.JTable courseTable;
    // End of variables declaration

    public void modelPropertyChange(PropertyChangeEvent event) {
         if ( event.getPropertyName().equals(IController.APP_ADDED_COURSE) ) {
             log.info("ADD THE CourseEntryItem to the VIEW...");
         }
         else if( event.getPropertyName().equals(IController.APP_REMOVED_COURSE)) {
             log.info("REMOVE THE CourseEntryItem from the VIEW...");
             
         }
    }
}